<!--/**
* Author: ganqz
* Date: 2022-08-10 19:02
* Desc: InviteUser
*/
-->
<template>
  <view
    class="flex flex-m invite-user"
    :style="{ color, background }"
    :class="customClass"
    v-if="info.headImg || info.userName"
  >
    <zm-image
      v-if="info.headImg"
      shape="circle"
      width="48rpx"
      height="48rpx"
      :src="info.headImg"
    />
    <view v-if="info.userName" class="ml20">来自{{ info.userName }}的分享</view>
  </view>
</template>
<script>
  import ZmImage from '@/commons/ZmImage/index.vue'
  import styleMixins from '@/mixins/styleMixins.ts'
  import { mapGetters } from 'vuex'
  export default {
    name: 'invite-user',
    components: { ZmImage },
    mixins: [styleMixins],
    props: {
      color: {
        type: String,
        default: '#fff'
      },
      background: {
        type: String,
        default: 'transparent'
      }
    },
    data() {
      return {
        info: {}
      }
    },
    computed: {
      ...mapGetters(['shareInfo', 'showUser'])
    },
    mounted() {
      // this.init()
    },
    methods: {
      init() {
        uni.$api.user
          .getInviteData({ memberId: this.shareInfo.memberId })
          .then((res) => {
            this.info = res
          })
      }
    }
  }
</script>
<style lang="scss" scoped>
  .invite-user {
    padding: 26upx 22upx;
  }
</style>
